<script type="text/javascript">
	$(document).ready(function() {
		$('#data').dataTable({
			"bJQueryUI" : true,
			"aoColumnDefs" : [{
				"sType" : "formatted-num",
				"aTargets" : [2, 3]
			}]
		});
		$('.fg-toolbar').css('display', 'none');
	}); 
</script>
<style>
#detalle td{
	height: 30px;
	vertical-align: middle;
	font-weight: bold;
	padding-left: 10px;
	color: #365169;
}
.par td{
	background: #E2E4FF;
}
</style>
<?php
	$submit = array(
		'label' => 'Registrar',
		'name' => 'data[accion]',
		'class' => 'but',
		'div' => false
	);
echo $this->Form->create('Venta', array('action' => 'registrar' ,'type' => 'post')); ?>
<table cellpadding="0" cellspacing="0" border="0"  id="detalle" style="width:540px">
	<tr class="par">
		<td>N&deg; Comprobante</td>
		<td><input type="text" name="data[Venta][nrocomprobante]" value="<?php if(!empty($venta)){echo $venta['Venta']['nrocomprobante']; } ?>"></td>
		<td>Fecha</td>
		<td>
			<?php date_default_timezone_set("America/Lima"); ?>
			<input type="text"  name="data[Venta][fecha]" value="<?php echo date('d')."/".date('m')."/".date('Y'); ?>">
		</td>
	</tr>
	<tr>
		<td>Tipo de Comprobante</td>
		<td>
			<select name="data[Venta][tipocomprobante]" style="width:153px;">				
				<?php if(!empty($venta)){ ?>
				<option value="0" <?php if($venta['Venta']['tipocomprobante']==0){?> selected='on' <?php }?>>Recibo</option>
				<option value="1" <?php if($venta['Venta']['tipocomprobante']==1){?> selected='on' <?php }?>>Boleta</option>
				<option value="2" <?php if($venta['Venta']['tipocomprobante']==2){?> selected='on' <?php }?>>Factura</option>
				<?php  }else{ ?>
				<option value="-1">Seleccionar</option>
				<option value="0">Recibo</option>
				<option value="1">Boleta</option>
				<option value="2">Factura</option>
				<?php } ?>
			</select>
		</td>
		<td>Tienda</td>
		<td>
			<select name="data[Venta][tiendas_id]" style="width:153px;">
				<option value="-1">Seleccionar</option>
			  		<?php foreach ($tiendas as $t) { ?>
						<option value="<?php echo $t['Tienda']['id']?>"><?php echo $t['Tienda']['nombre'] ?></option>							
					<?php } ?>					
			</select>
		</td>
	</tr>
	<tr class="par">
		<td>Vendedor</td>
		<td>
			<?php
				$apellido = $this->Session->read('apellido');
				echo $apellido;
			?>
		</td>
		<td></td>
		<td></td>
	</tr>
	<tr>
		<td>Cliente</td>
		<td><input type="text" name="data[Venta][comprador]" value="<?php if(!empty($venta)){ echo $venta['Venta']['comprador'];  }?>"></td>
		<td>RUC N&deg;</td>
		<td><input type="text" name="data[Venta][ruc]" maxlength="11" value="<?php if(!empty($venta)){echo $venta['Venta']['ruc'];  }?>"></td>
	</tr>
</table>
<div style="width:510px;text-align:right;"><?php echo $this->Form->end($submit); ?></div>
<table cellpadding="0" cellspacing="0" border="0" class="display" id="data" style="width:540px">
	<thead>
		<tr>
			<th>Cantidad</th>
			<th>Producto</th>
			<th>Precio unitario</th>
			<th>Monto</th>
		</tr>
	</thead>
	<tbody>
		<!--<?php foreach ($productos as $p) { ?>-->
		<tr>
			<td style="vertical-align:middle;"></td>
			<td style="vertical-align:middle;"></td>
			<td style="text-align:right; vertical-align:middle;"></td>
			<td style="text-align:right; vertical-align:middle;"></td>
		</tr>
		<!--<?php } ?>-->
	</tbody>
</table>